package top.saycode.schedule.base.common;

import lombok.Getter;

import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.Locale;
import java.util.function.BiFunction;

@Getter
public enum TaskUnit {

    INTERVAL(null, "时间间隔"),
    MONTH(DateTimeFormatter.ofPattern("dd'T'HH:mm:ss"), "月"),
    WEEK(DateTimeFormatter.ofPattern("e'T'HH:mm:ss", Locale.CHINA), "周"),
    DATE(DateTimeFormatter.ofPattern("HH:mm:ss"), "日"),
    HOUR(DateTimeFormatter.ofPattern("mm:ss"), "小时"),
    MINUTE(DateTimeFormatter.ofPattern("ss"), "分钟"),
    ONCE(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss"), "单次")
    ;

    private final DateTimeFormatter dateTimeFormatter;

    private final String description;

    TaskUnit(DateTimeFormatter dateTimeFormatter, String description) {
        this.dateTimeFormatter = dateTimeFormatter;
        this.description = description;
    }

}
